<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>computeUnitOfWork</title>
  </head>
  <body>
    <div id="root"></div>
    <script src="../../libs/babel.min.js"></script>
    <script src="../../libs/react-17.0.2.js"></script>
    <script src="../../libs/react-dom-17.0.2.js"></script>
    <script type="text/babel">
      const Child2 = props => {
        return <div>this is Child {props.count}</div>
      }
      const Child = () => {
        const [arr, setArr] = React.useState([0, 1, 2])
        const handleClickBtn = () => {
          setArr(arr => arr.map(item => item * 2))
        }

        return (
          <div>
            <ul>
              {arr.map(item => (
                <li key={item}>
                  <span>{item}</span>
                </li>
              ))}
            </ul>
            <button onClick={handleClickBtn}>切换</button>
          </div>
        )
      }
      const App = props => {
        return (
          <div>
            <Child />
          </div>
        )
      }
      const root = document.getElementById("root")
      ReactDOM.render(<App app={1} />, root)
      console.dir(root)
    </script>
  </body>
</html>
